package tests;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import btree.IntegerKey;
import btree.KeyClass;
import btree.StringKey;

public class Helper {
	
	  public static KeyClass getChoice () {
		    
		    BufferedReader in = new BufferedReader (new InputStreamReader(System.in));
		    int choice = -1;
		    KeyClass key;
			String s="";
		    try {
		    	s=in.readLine();
		      choice = Integer.parseInt(s);
		      key=(IntegerKey)new IntegerKey(choice);
		    }
		    catch (NumberFormatException e) {
			      key=(btree.StringKey)new StringKey(s);		    	
		      return key;
		    }
		    catch (IOException e) {
		      return null;
		    }
		    
		    return key;
		  } 

}
